﻿package mortal.game.view.task.data
{
    import Message.DB.Tables.*;
    import Message.Game.*;
    import Message.Public.*;
    import __AS3__.vec.*;
    import com.mui.controls.*;
    import extend.language.*;
    import flash.utils.*;
    import mortal.component.gLinkText.*;
    import mortal.component.gconst.*;
    import mortal.game.cache.*;
    import mortal.game.manager.*;
    import mortal.game.model.*;
    import mortal.game.resource.*;
    import mortal.game.resource.info.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.scene3D.layer3D.utils.*;
    import mortal.game.scene3D.map3D.mapToMapPath.*;
    import mortal.game.scene3D.map3D.sceneInfo.*;
    import mortal.game.scene3D.map3D.util.*;

    public class GLinkTextDataParser extends Object
    {
        private static var _leftCom:RegExp = /\[""\[/g;
        private static var _rightCom:RegExp = /\]""\]/g;
        private static var _pool:Array = [];

        public function GLinkTextDataParser()
        {
            return;
        }// end function

        public static function parse(param1:TaskInfo) : Array
        {
            var _loc_5:Array = null;
            var _loc_6:int = 0;
            var _loc_7:GLinkTextData = null;
            var _loc_8:String = null;
            var _loc_9:int = 0;
            var _loc_2:* = parseProcess(param1.stask.processMap, param1);
            if (String(param1.stask.context).length >= 2)
            {
                _loc_5 = parseContextLinkTexts(param1.stask.context as String, param1);
                _loc_6 = 0;
                while (_loc_6 < _loc_2.length)
                {
                    
                    _loc_7 = _loc_2[_loc_6][0] as GLinkTextData;
                    _loc_8 = _loc_5[_loc_6];
                    if (_loc_7 == null || _loc_8 == null)
                    {
                    }
                    else
                    {
                        _loc_9 = _loc_8.indexOf("@");
                        if (_loc_9 > 0)
                        {
                            _loc_8 = _loc_8.substr(0, _loc_9);
                            _loc_7.needBoot = true;
                        }
                        else
                        {
                            _loc_7.needBoot = false;
                        }
                        _loc_7.htmlText = _loc_8;
                    }
                    _loc_6++;
                }
            }
            var _loc_3:* = parseDataFromNpcId(param1.stask.getNpc, param1, 20161, param1.stask.getDistance);
            _loc_3.htmlText = _loc_3.htmlText + Language.getString(21100);
            var _loc_4:* = parseDataFromNpcId(param1.stask.endNpc, param1, 20162, param1.stask.endDistance, true);
            _loc_2.unshift([_loc_3]);
            _loc_2.push([_loc_4]);
            return _loc_2;
        }// end function

        private static function parseContextLinkTexts(param1:String, param2:TaskInfo) : Array
        {
            var _loc_6:TTaskDialog = null;
            var _loc_7:String = null;
            var _loc_8:Array = null;
            var _loc_3:Array = [];
            var _loc_4:* = param1.split("#");
            var _loc_5:int = 0;
            while (_loc_5 < _loc_4.length)
            {
                
                _loc_6 = TaskConfig.instance.getDialog(_loc_4[_loc_5]);
                if (_loc_6 == null)
                {
                }
                else
                {
                    _loc_7 = _loc_6.talkStr;
                    _loc_8 = _loc_7.split(GLinkTextConst.text_TargetSpliter);
                    if (_loc_8[0] == null)
                    {
                        MsgManager.showRollTipsMsg("在ttaskDialog表中，id=" + int(_loc_4[_loc_5]).toString() + "的配置，没有配置talkStr字段");
                    }
                    else
                    {
                        _loc_3.push(parseToHtmlFormat(_loc_8[0] as String));
                    }
                }
                _loc_5++;
            }
            return _loc_3;
        }// end function

        public static function parseContext(param1:String, param2:TaskInfo) : Array
        {
            var _loc_6:TTaskDialog = null;
            var _loc_7:String = null;
            var _loc_8:Array = null;
            var _loc_9:GLinkTextData = null;
            var _loc_10:Array = null;
            var _loc_3:Array = [];
            var _loc_4:* = param1.split("#");
            var _loc_5:int = 0;
            while (_loc_5 < _loc_4.length)
            {
                
                _loc_6 = TaskConfig.instance.getDialog(_loc_4[_loc_5]);
                if (_loc_6 == null)
                {
                }
                else
                {
                    _loc_7 = _loc_6.talkStr;
                    _loc_8 = _loc_7.split(GLinkTextConst.text_TargetSpliter);
                    _loc_9 = outPool();
                    _loc_9.data = param2;
                    _loc_3.push([_loc_9]);
                    if (_loc_8[0] == null)
                    {
                        MsgManager.showRollTipsMsg("在ttaskDialog表中，id=" + int(_loc_4[_loc_5]).toString() + "的配置，没有配置talkStr字段");
                    }
                    else
                    {
                        _loc_9.htmlText = parseToHtmlFormat(_loc_8[0] as String);
                    }
                    if (_loc_8.length > 1)
                    {
                        _loc_10 = String(_loc_8[1]).split(GLinkTextConst.targetSpliter);
                        _loc_9.mapId = int(_loc_10[0]);
                        _loc_9.x = param2.getTargetX((_loc_5 + 1));
                        _loc_9.y = param2.getTargetX(_loc_5 + 2);
                        _loc_9.type = String(_loc_10[3]);
                        _loc_9.value1 = int(_loc_10[4]);
                        if (_loc_10.length > 5)
                        {
                            _loc_9.value2 = int(_loc_10[5]);
                        }
                    }
                    else
                    {
                        _loc_9.mapId = -1;
                    }
                    if (_loc_8.length > 2 && _loc_8[2] == "@")
                    {
                        _loc_9.needBoot = true;
                    }
                    else
                    {
                        _loc_9.needBoot = false;
                    }
                }
                _loc_5++;
            }
            return _loc_3;
        }// end function

        public static function parseToHtmlFormat(param1:String) : String
        {
            var _loc_5:String = null;
            var _loc_6:String = null;
            if (param1 == null)
            {
                return "";
            }
            var _loc_2:String = "";
            param1 = param1.replace("{name}", Cache.instance.role.playerInfo.name);
            param1 = param1.replace(/}""}/g, "{");
            var _loc_3:* = param1.split("{");
            if (_loc_3[0] != null)
            {
                _loc_2 = _loc_2 + _loc_3[0];
            }
            var _loc_4:int = 1;
            while (_loc_4 < _loc_3.length)
            {
                
                _loc_5 = _loc_3[_loc_4];
                _loc_6 = _loc_3[(_loc_4 + 1)];
                if (_loc_5 == "" || _loc_5 == null)
                {
                }
                else
                {
                    _loc_2 = _loc_2 + ("<font color=\'" + _loc_5.substr(0, 7) + "\'>" + _loc_5.substr(7) + "</font>");
                    if (_loc_6 != null)
                    {
                        _loc_2 = _loc_2 + _loc_6;
                    }
                }
                _loc_4 = _loc_4 + 2;
            }
            _loc_2 = _loc_2.replace(_leftCom, "<u><a href=\'event:0\'>");
            _loc_2 = _loc_2.replace(_rightCom, "</a></u>");
            return _loc_2;
        }// end function

        public static function parseProcess(param1:Dictionary, param2:TaskInfo, param3:Boolean = false) : Array
        {
            var _loc_12:Array = null;
            var _loc_13:Array = null;
            var _loc_14:Boolean = false;
            var _loc_15:int = 0;
            var _loc_16:SProcess = null;
            var _loc_17:GLinkTextData = null;
            var _loc_18:int = 0;
            var _loc_19:Vector.<SPassPoint> = null;
            var _loc_20:BossInfo = null;
            var _loc_21:String = null;
            var _loc_22:int = 0;
            var _loc_23:int = 0;
            var _loc_24:int = 0;
            var _loc_25:int = 0;
            var _loc_26:int = 0;
            var _loc_27:SceneInfo = null;
            var _loc_28:SPassPoint = null;
            var _loc_29:SPassTo = null;
            var _loc_30:int = 0;
            var _loc_31:int = 0;
            var _loc_32:String = null;
            var _loc_33:Array = null;
            var _loc_34:Array = null;
            var _loc_35:int = 0;
            var _loc_36:String = null;
            var _loc_37:Array = null;
            var _loc_38:int = 0;
            var _loc_39:String = null;
            var _loc_40:String = null;
            var _loc_41:int = 0;
            var _loc_42:ColorInfo = null;
            var _loc_43:SConditon = null;
            var _loc_4:String = "";
            var _loc_5:String = "";
            var _loc_6:String = "";
            var _loc_7:String = "";
            var _loc_8:int = 0;
            var _loc_9:int = 1;
            var _loc_10:Array = [];
            var _loc_11:int = 1;
            while (_loc_11 < 10)
            {
                
                if (!param1.hasOwnProperty(_loc_11.toString()))
                {
                    break;
                }
                _loc_12 = param1[_loc_11];
                if (_loc_12 == null || _loc_12.length == 0)
                {
                }
                else
                {
                    _loc_13 = [];
                    _loc_14 = false;
                    _loc_15 = 0;
                    while (_loc_15 < _loc_12.length)
                    {
                        
                        _loc_16 = _loc_12[_loc_15];
                        _loc_17 = outPool();
                        _loc_17.data = param2;
                        _loc_17.x = _loc_16.contents[_loc_16.contents.length - 2];
                        _loc_17.y = _loc_16.contents[(_loc_16.contents.length - 1)];
                        _loc_17.needBoot = true;
                        _loc_17.curNum = 0;
                        _loc_17.totalNum = 0;
                        if (!param2.isCanget())
                        {
                            _loc_17.curNum = param2.playerTask.stepRecords[_loc_15];
                        }
                        if (param2.stask.group == ETaskGroup._ETaskGroupGuild)
                        {
                            _loc_17.tips = Language.getStringByParam(21101, "TaskGuideShowGuildShareList");
                        }
                        _loc_13.push(_loc_17);
                        switch(_loc_16.type)
                        {
                            case ETaskProcess._ETaskProcessReachMap:
                            {
                                _loc_17.needBoot = true;
                                _loc_17.type = GLinkTextData.Point;
                                _loc_18 = _loc_16.contents[0];
                                _loc_17.mapId = _loc_18;
                                _loc_17.linkName = GameMapConfig.instance.getMapInfo(_loc_18).name;
                                _loc_17.htmlText = Language.getStringByParam(21103, _loc_17.linkName);
                                if (GameMapUtil.isGuildMap(_loc_18))
                                {
                                    _loc_17.type = GLinkTextData.branchGuide;
                                    _loc_17.htmlText = Language.getStringByParam(21102, "TaskGuideEnterGuild", _loc_17.linkName);
                                }
                                _loc_19 = MapPathSearcher.findMapPath(GameMapUtil.curMapState.curSceneInfo.sMapDefine.mapId, _loc_18);
                                if (_loc_19 != null && _loc_19.length > 0)
                                {
                                    _loc_28 = _loc_19[(_loc_19.length - 1)];
                                    _loc_29 = _loc_28.passTo[0] as SPassTo;
                                    if (PassUtil.isPassToCopyType(_loc_29))
                                    {
                                        _loc_27 = SceneConfig.instance.getSceneInfo(_loc_18);
                                        if (_loc_27 && _loc_27.passInfos != null && _loc_27.passInfos.length > 0)
                                        {
                                            _loc_28 = _loc_27.passInfos[0];
                                            _loc_17.x = _loc_28.point.x;
                                            _loc_17.y = _loc_28.point.y;
                                        }
                                        else
                                        {
                                            _loc_17.x = 1000;
                                            _loc_17.y = 1000;
                                        }
                                    }
                                    else
                                    {
                                        _loc_17.x = _loc_29.toPoint.x;
                                        _loc_17.y = _loc_29.toPoint.y;
                                    }
                                }
                                break;
                            }
                            case ETaskProcess._ETaskProcessGuide:
                            {
                                _loc_17.needBoot = false;
                                _loc_17.type = "GuideTask_StartFromRecord";
                                _loc_17.linkName = Language.getString(21104);
                                _loc_17.htmlText = Language.getStringByParam(21105, "GuideTask_StartFromRecord");
                                break;
                            }
                            case ETaskProcess._ETaskProcessNewCollect:
                            case ETaskProcess._ETaskProcessCollect:
                            {
                                _loc_4 = GameMapConfig.instance.getMapInfo(_loc_16.contents[1]).name;
                                _loc_20 = BossConfig.instance.getInfoByCode(_loc_16.contents[0]);
                                _loc_5 = _loc_20.name;
                                _loc_17.totalNum = _loc_16.contents[2];
                                _loc_21 = Language.getString(21106);
                                if (_loc_20.physDefense == 1)
                                {
                                    _loc_21 = Language.getString(21107);
                                }
                                _loc_17.htmlText = Language.getStringByParam(21108, _loc_21, _loc_5);
                                _loc_17.mapId = _loc_16.contents[1];
                                _loc_17.type = GLinkTextData.boss;
                                _loc_17.value1 = _loc_16.contents[0];
                                _loc_17.linkName = _loc_5;
                                if (_loc_16.type == ETaskProcess._ETaskProcessNewCollect)
                                {
                                    if (param2.isDoing())
                                    {
                                        _loc_25 = 0;
                                        for each (_loc_43 in param2.stask.completeConditions)
                                        {
                                            
                                            if (_loc_43.type == ETaskCompleteCondition._ETaskCompleteConditionTime)
                                            {
                                                _loc_25 = _loc_43.num;
                                            }
                                        }
                                        _loc_17.endSecond = param2.playerTask.createDt.time / 1000 + _loc_25 * 60;
                                        _loc_17.htmlText = Language.getStringByParam(21109, _loc_21, _loc_5);
                                    }
                                    _loc_17.subType = "";
                                    _loc_30 = _loc_16.contents.length - 2;
                                    _loc_31 = 6;
                                    while (_loc_31 < _loc_30)
                                    {
                                        
                                        if (_loc_31 != (_loc_30 - 1))
                                        {
                                            _loc_17.subType = _loc_17.subType + (_loc_16.contents[_loc_31].toString() + ";");
                                        }
                                        else
                                        {
                                            _loc_17.subType = _loc_17.subType + _loc_16.contents[_loc_31].toString();
                                        }
                                        _loc_31++;
                                    }
                                }
                                break;
                            }
                            case ETaskProcess._ETaskProcessDeliver:
                            {
                                _loc_6 = ItemConfig.instance.getConfig(_loc_16.contents[1]).htmlName;
                                _loc_7 = NPCConfig.instance.getInfoByCode(_loc_16.contents[0]).name;
                                _loc_4 = GameMapConfig.instance.getMapInfo(_loc_16.contents[2]).name;
                                _loc_17.htmlText = Language.getStringByParam(21110, _loc_6, _loc_7);
                                _loc_17.mapId = _loc_16.contents[2];
                                _loc_17.type = GLinkTextData.npc;
                                _loc_17.value1 = _loc_16.contents[0];
                                _loc_17.linkName = _loc_7;
                                break;
                            }
                            case ETaskProcess._ETaskProcessDialog:
                            {
                                if (_loc_16.contents[0] > 0)
                                {
                                    _loc_7 = NPCConfig.instance.getInfoByCode(_loc_16.contents[0]).name;
                                    _loc_4 = GameMapConfig.instance.getMapInfo(_loc_16.contents[2]).name;
                                    _loc_17.htmlText = Language.getStringByParam(20149, "<u><a href=\'event:0\'><font color=\'#00ff00\'>" + _loc_4 + "</font></a></u>", "<u><a href=\'event:1\'><font color=\'#00E4FF\'>" + _loc_7 + "</font></a></u>");
                                    _loc_17.type = GLinkTextData.npc;
                                    _loc_17.linkName = _loc_7;
                                }
                                else
                                {
                                    _loc_17.htmlText = Language.getString(21111);
                                    _loc_17.type = TaskUtil.isEscortTask(param2) ? (GLinkTextData.escort) : (GLinkTextData.self);
                                    _loc_17.needBoot = false;
                                    _loc_17.linkName = Language.getString(21112);
                                }
                                _loc_17.mapId = _loc_16.contents[2];
                                _loc_17.value1 = _loc_16.contents[0];
                                if (_loc_16.contents[1] == 0)
                                {
                                    _loc_14 = true;
                                }
                                break;
                            }
                            case ETaskProcess._ETaskProcessDrama:
                            {
                                _loc_17.htmlText = Language.getString(20232);
                                _loc_17.type = GLinkTextData.drama;
                                _loc_17.linkName = Language.getString(21113);
                                _loc_17.needBoot = false;
                                break;
                            }
                            case ETaskProcess._ETaskProcessDrop:
                            {
                                _loc_6 = ItemConfig.instance.getConfig(_loc_16.contents[1]).htmlName;
                                _loc_5 = BossConfig.instance.getInfoByCode(_loc_16.contents[0]).name;
                                _loc_4 = GameMapConfig.instance.getMapInfo(_loc_16.contents[2]).name;
                                _loc_17.totalNum = _loc_16.contents[3];
                                _loc_17.htmlText = Language.getStringByParam(21114, _loc_5, _loc_6);
                                _loc_17.mapId = _loc_16.contents[2];
                                _loc_17.type = GLinkTextData.boss;
                                _loc_17.value1 = _loc_16.contents[0];
                                _loc_17.linkName = _loc_5;
                                break;
                            }
                            case ETaskProcess._ETaskProcessEscort:
                            {
                                _loc_7 = NPCConfig.instance.getInfoByCode(_loc_16.contents[2]).name;
                                _loc_5 = BossConfig.instance.getInfoByCode(_loc_16.contents[0]).name;
                                _loc_4 = GameMapConfig.instance.getMapInfo(_loc_16.contents[1]).name;
                                _loc_17.mapId = _loc_16.contents[1];
                                _loc_17.type = GLinkTextData.npc;
                                _loc_17.subType = GLinkTextData.subType_Escort;
                                _loc_17.value1 = _loc_16.contents[2];
                                _loc_17.needBoot = false;
                                _loc_17.htmlText = Language.getStringByParam(21115, _loc_5, _loc_7);
                                _loc_17.linkName = _loc_7;
                                break;
                            }
                            case ETaskProcess._ETaskProcessExplore:
                            {
                                _loc_4 = GameMapConfig.instance.getMapInfo(_loc_16.contents[1]).name;
                                _loc_17.x = _loc_16.contents[2];
                                _loc_17.y = _loc_16.contents[3];
                                _loc_17.mapId = _loc_16.contents[1];
                                _loc_17.type = GLinkTextData.Point;
                                _loc_17.linkName = "(" + _loc_17.x.toString() + ", " + _loc_17.y.toString() + ")";
                                _loc_17.htmlText = Language.getStringByParam(21116, _loc_4);
                                break;
                            }
                            case ETaskProcess._ETaskProcessIntroduce:
                            {
                                _loc_17.htmlText = Language.getString(21117);
                                _loc_17.linkName = Language.getString(21117);
                                _loc_17.needBoot = false;
                                if (param3)
                                {
                                    _loc_32 = TaskConfig.instance.getDialog(_loc_16.contents[0]).talkStr;
                                    _loc_33 = _loc_32.split("&");
                                    _loc_34 = [];
                                    _loc_35 = 0;
                                    while (_loc_35 < _loc_33.length)
                                    {
                                        
                                        _loc_36 = _loc_33[_loc_35];
                                        if (_loc_36 == null || _loc_36 == "")
                                        {
                                        }
                                        else
                                        {
                                            _loc_37 = _loc_36.split("#");
                                            _loc_17.value1 = parseInt(_loc_37[0]);
                                            _loc_17.htmlText = _loc_37[1];
                                            _loc_17.value2 = parseInt(_loc_37[2]) * 1000;
                                            _loc_17.type = GLinkTextData.introduce;
                                            _loc_34.push(_loc_17);
                                        }
                                        _loc_35++;
                                    }
                                    return [_loc_34];
                                }
                                break;
                            }
                            case ETaskProcess._ETaskProcessKill:
                            {
                                _loc_4 = GameMapConfig.instance.getMapInfo(_loc_16.contents[1]).name;
                                _loc_20 = BossConfig.instance.getInfoByCode(_loc_16.contents[0]);
                                if (_loc_20 != null)
                                {
                                    _loc_5 = _loc_20.name;
                                }
                                else
                                {
                                    _loc_5 = "TBoss没配置code=" + _loc_16.contents[0];
                                }
                                _loc_17.mapId = _loc_16.contents[1];
                                _loc_17.type = GLinkTextData.boss;
                                _loc_17.value1 = _loc_16.contents[0];
                                _loc_17.totalNum = _loc_16.contents[2];
                                _loc_17.htmlText = Language.getStringByParam(21118, _loc_5);
                                _loc_17.linkName = _loc_5;
                                break;
                            }
                            case ETaskProcess._ETaskProcessTreasure:
                            {
                                _loc_4 = GameMapConfig.instance.getMapInfo(_loc_16.contents[0]).name;
                                _loc_17.x = _loc_16.contents[1];
                                _loc_17.y = _loc_16.contents[2];
                                _loc_17.mapId = _loc_16.contents[0];
                                _loc_17.type = GLinkTextData.Point;
                                _loc_17.htmlText = Language.getStringByParam(21119, _loc_4);
                                _loc_17.linkName = _loc_4;
                                break;
                            }
                            case ETaskProcess._ETaskProcessCount:
                            {
                                _loc_22 = _loc_16.contents[0];
                                _loc_9 = _loc_16.contents[1];
                                _loc_23 = _loc_16.contents[2];
                                _loc_17.totalNum = _loc_9;
                                _loc_17.needBoot = false;
                                _loc_17.type = GLinkTextData.branchGuide;
                                switch(_loc_22)
                                {
                                    case ETaskCountType._ETaskCountTypeGuild:
                                    {
                                        _loc_17.htmlText = Language.getStringByParam(21120, _loc_9, "TaskGuideCreateGuild");
                                        break;
                                    }
                                    case ETaskCountType._ETaskCountTypeSingleCopyParticipate:
                                    {
                                        _loc_17.linkName = Language.getString(21121);
                                        _loc_17.htmlText = Language.getStringByParam(21122, _loc_9, "TaskGuideSingleCopy");
                                        break;
                                    }
                                    case ETaskCountType._ETaskCountTypeGroupCopyParticipate:
                                    {
                                        var _loc_44:* = Language.getStringByParam(21123, _loc_9, "TaskGuideGroupCopy");
                                        _loc_17.htmlText = Language.getStringByParam(21123, _loc_9, "TaskGuideGroupCopy");
                                        _loc_17.htmlText = _loc_44;
                                        break;
                                    }
                                    case ETaskCountType._ETaskCountTypeDefendCopyParticipate:
                                    {
                                        _loc_17.htmlText = Language.getStringByParam(21124, _loc_9, "TaskGuideDefenceCopy");
                                        break;
                                    }
                                    case ETaskCountType._ETaskCountTypeChallengeCopyProcess:
                                    {
                                        _loc_38 = _loc_16.contents[1];
                                        _loc_9 = _loc_16.contents[3];
                                        _loc_39 = Language.getString(21125);
                                        if (_loc_38 == ECopyDifficulty._ECopyDifficultyHard)
                                        {
                                            _loc_39 = Language.getString(21126);
                                        }
                                        else if (_loc_38 == ECopyDifficulty._ECopyDifficultyPurgatory)
                                        {
                                            _loc_39 = Language.getString(21127);
                                        }
                                        _loc_17.x = _loc_23;
                                        _loc_17.y = _loc_9;
                                        _loc_17.totalNum = 1;
                                        _loc_17.subType = GLinkTextData.subType_Challenge;
                                        _loc_17.htmlText = Language.getStringByParam(21128, "TaskGuideChanllengeCopy", _loc_23, _loc_9);
                                        if (param2.isComplete())
                                        {
                                            _loc_17.curNum = 1;
                                        }
                                        else
                                        {
                                            _loc_17.curNum = 0;
                                        }
                                        break;
                                    }
                                    case ETaskCountType._ETaskCountTypeMountLevel:
                                    {
                                        _loc_17.htmlText = Language.getStringByParam(21129, "TaskGuideMountLevel", _loc_9);
                                        break;
                                    }
                                    case ETaskCountType._ETaskCountTypePetGrowth:
                                    {
                                        _loc_17.htmlText = Language.getStringByParam(21130, "TaskGuidePetGrouth", _loc_9);
                                        break;
                                    }
                                    case ETaskCountType._ETaskCountTypeEquipStrenthen:
                                    {
                                        _loc_17.htmlText = Language.getStringByParam(21131, "TaskGuideEquipStrenthen", _loc_9, _loc_23);
                                        break;
                                    }
                                    case ETaskCountType._ETaskCountTypeSpriteLevel:
                                    {
                                        _loc_17.htmlText = Language.getStringByParam(21132, "TaskGuideSpriteLevel", _loc_9);
                                        break;
                                    }
                                    case ETaskCountType._ETaskCountTypeAcupointLevel:
                                    {
                                        _loc_17.htmlText = Language.getStringByParam(21133, "TaskGuideAcupointLevel", _loc_9);
                                        break;
                                    }
                                    case ETaskCountType._ETaskCountTypeJewelAdvance:
                                    {
                                        _loc_17.htmlText = Language.getStringByParam(21134, "TaskGuideJewelAdvance", _loc_9, _loc_23);
                                        break;
                                    }
                                    case ETaskCountType._ETaskCountTypeEquipRefresh:
                                    {
                                        _loc_17.htmlText = Language.getStringByParam(21135, "TaskGuideEquipRefresh", _loc_9, _loc_23);
                                        break;
                                    }
                                    case ETaskCountType._ETaskCountTypeEquipQuality:
                                    {
                                        _loc_40 = GameDefConfig.instance.getEPrefixx(_loc_23).text;
                                        _loc_17.htmlText = Language.getStringByParam(21136, "TaskGuideEquipQuality", _loc_9, _loc_40);
                                        break;
                                    }
                                    case ETaskCountType._ETaskCountTypeTowerCopy:
                                    {
                                        _loc_17.htmlText = Language.getStringByParam(21137, "TaskGuideTowerCopy", _loc_9);
                                        break;
                                    }
                                    case ETaskCountType._ETaskCountTypePetMerge:
                                    {
                                        _loc_17.htmlText = Language.getStringByParam(21138, "TaskGuieePetMerge");
                                        break;
                                    }
                                    case ETaskCountType._ETaskCountTypePetLearnSkill:
                                    {
                                        _loc_17.htmlText = Language.getStringByParam(21139, "TaskGuidePetSkill");
                                        break;
                                    }
                                    case ETaskCountType._ETaskCountTypeTaskGroup:
                                    {
                                        switch(_loc_23)
                                        {
                                            case ETaskGroup._ETaskGroupLoop:
                                            {
                                                _loc_17.linkName = Language.getString(21140);
                                                _loc_17.htmlText = Language.getStringByParam(21145, _loc_9, "TaskGuideLoopTaskCount", Language.getString(21140));
                                                break;
                                            }
                                            case ETaskGroup._ETaskGroupGuild:
                                            {
                                                _loc_17.htmlText = Language.getStringByParam(21145, _loc_9, "TaskGuideGuildTaskCount", Language.getString(21141));
                                                break;
                                            }
                                            case ETaskGroup._ETaskGroupPvp:
                                            {
                                                _loc_17.htmlText = Language.getStringByParam(21145, _loc_9, "TaskGuidePvpCount", Language.getString(21142));
                                                break;
                                            }
                                            case ETaskGroup._ETaskGroupAutoFight:
                                            {
                                                _loc_17.htmlText = Language.getStringByParam(21145, _loc_9, "TaskGuideAutoFightCount", Language.getString(21143));
                                                break;
                                            }
                                            case ETaskGroup._ETaskGroupMinning:
                                            {
                                                _loc_17.htmlText = Language.getStringByParam(21145, _loc_9, "TaskGuideMiningCount", Language.getString(21144));
                                                break;
                                            }
                                            default:
                                            {
                                                break;
                                            }
                                        }
                                        break;
                                    }
                                    case ETaskCountType._ETaskCountTypeEScort:
                                    {
                                        _loc_41 = 0;
                                        if (param2.playerTask != null)
                                        {
                                            _loc_41 = param2.playerTask.extend;
                                        }
                                        _loc_42 = ColorConfig.instance.getItemColor(_loc_41);
                                        _loc_17.htmlText = Language.getStringByParam(21146, _loc_42.color, _loc_42.colorText);
                                        _loc_17.type = GLinkTextData.npc;
                                        _loc_17.needBoot = false;
                                        _loc_17.subType = GLinkTextData.subType_Escort;
                                        _loc_17.value1 = param2.stask.endNpc;
                                        _loc_27 = SceneConfig.instance.getSceneInfoByNpcId(_loc_17.value1);
                                        if (_loc_27 != null)
                                        {
                                            _loc_17.mapId = _loc_27.sMapDefine.mapId;
                                        }
                                        else
                                        {
                                            _loc_17.mapId = 90000;
                                            Alert.show("运镖任务找不到npcid=" + _loc_17.value1 + "的地图配置");
                                        }
                                        break;
                                    }
                                    default:
                                    {
                                        break;
                                    }
                                }
                                break;
                            }
                            case ETaskProcess._ETaskProcessAutoFight:
                            {
                                _loc_17.type = GLinkTextData.branchGuide;
                                _loc_17.subType = GLinkTextData.subType_TaskAutoFight;
                                _loc_4 = GameMapConfig.instance.getMapInfo(_loc_16.contents[0]).name;
                                if (!param2 || !param2.playerTask)
                                {
                                    return [];
                                }
                                _loc_24 = param2.playerTask.extend;
                                _loc_17.mapId = _loc_16.contents[0];
                                _loc_17.value2 = _loc_24;
                                _loc_17.value1 = -1;
                                _loc_17.totalNum = 3000;
                                _loc_25 = 0;
                                for each (_loc_43 in param2.stask.completeConditions)
                                {
                                    
                                    if (_loc_43.type == ETaskCompleteCondition._ETaskCompleteConditionTime)
                                    {
                                        _loc_25 = _loc_43.num;
                                    }
                                }
                                _loc_26 = TaskUtil.getNumByERewardType(param2, EReward._ERewardExp);
                                _loc_17.endSecond = param2.playerTask.createDt.time / 1000 + _loc_25 * 60;
                                _loc_17.htmlText = Language.getStringByParam(21147, "TaskGuideTaskAutoFight", _loc_4, "TaskGuideTaskAutoFight", _loc_24) + "{0}/3000" + Language.getStringByParam(21148, _loc_26);
                                break;
                            }
                            case ETaskProcess._ETaskProcessPvp:
                            {
                                _loc_17.type = GLinkTextData.pvp;
                                _loc_4 = GameMapConfig.instance.getMapInfo(_loc_16.contents[0]).name;
                                _loc_17.mapId = _loc_16.contents[0];
                                _loc_17.totalNum = _loc_16.contents[1];
                                _loc_17.htmlText = Language.getStringByParam(21149, _loc_4, _loc_17.totalNum);
                                _loc_27 = SceneConfig.instance.getSceneInfo(_loc_17.mapId);
                                if (_loc_27 != null && _loc_27.passInfos != null && _loc_27.passInfos.length > 0)
                                {
                                    _loc_28 = _loc_27.passInfos[0] as SPassPoint;
                                    _loc_17.x = _loc_28.point.x;
                                    _loc_17.y = _loc_28.point.y;
                                }
                                else
                                {
                                    _loc_17.x = 1500;
                                    _loc_17.y = 1500;
                                }
                                break;
                            }
                            case ETaskProcess._ETaskProcessAutoFight:
                            {
                                _loc_17.type = GLinkTextData.branchGuide;
                                _loc_17.htmlText = Language.getStringByParam(21150, "TaskGuideEnterTowerCopy");
                                break;
                            }
                            case ETaskProcess._ETaskProcessFly:
                            {
                                _loc_17.needBoot = false;
                                _loc_17.type = GLinkTextData.fly;
                                _loc_17.mapId = _loc_16.contents[0];
                                _loc_17.value1 = _loc_16.contents[1];
                                _loc_17.htmlText = Language.getString(21151);
                                break;
                            }
                            default:
                            {
                                break;
                            }
                        }
                        _loc_15++;
                    }
                    if (!_loc_14)
                    {
                        _loc_10.push(_loc_13);
                    }
                }
                _loc_11++;
            }
            return _loc_10;
        }// end function

        public static function parseDataFromNpcId(param1:int, param2:TaskInfo, param3:int, param4:int = 0, param5:Boolean = false) : GLinkTextData
        {
            var _loc_8:TNpc = null;
            var _loc_9:NPCInfo = null;
            var _loc_10:Array = null;
            var _loc_11:int = 0;
            var _loc_12:SConditon = null;
            var _loc_6:* = SceneConfig.instance.getSceneInfoByNpcId(param1);
            var _loc_7:* = outPool();
            if (param2.stask.code == GameConst.TFreeCreateGuildTaskCode && param2.isCanget())
            {
                _loc_7.value1 = 0;
                _loc_7.type = GLinkTextData.branchGuide;
                _loc_7.htmlText = Language.getStringByParam(21152, "TaskGuideCreateGuild");
                _loc_7.needBoot = false;
            }
            else if (_loc_6 != null)
            {
                _loc_8 = NPCConfig.instance.getInfoByCode(param1);
                _loc_9 = _loc_6.getNpcInfo(param1);
                _loc_7.htmlText = Language.getStringByParam(param3, _loc_8.name);
                _loc_7.linkName = _loc_8.name;
                _loc_7.x = _loc_9.snpc.point.x;
                _loc_7.y = _loc_9.snpc.point.y;
                _loc_7.mapId = _loc_6.sMapDefine.mapId;
                _loc_7.type = GLinkTextData.npc;
            }
            else
            {
                _loc_7.htmlText = Language.getString(21153);
                _loc_7.type = TaskUtil.isEscortTask(param2) ? (GLinkTextData.escort) : (GLinkTextData.self);
                _loc_7.needBoot = false;
                _loc_7.linkName = Language.getString(21154);
            }
            if (param5)
            {
                _loc_10 = param2.stask.completeConditions;
                _loc_11 = 0;
                while (_loc_11 < _loc_10.length)
                {
                    
                    _loc_12 = _loc_10[_loc_11];
                    if (_loc_12.type == ETaskCompleteCondition._ETaskCompleteConditionLevel)
                    {
                        if (param2.stask.group != ETaskGroup._ETaskGroupMain)
                        {
                        }
                        else
                        {
                            _loc_7.isLevelEnouth = Cache.instance.role.roleInfo.level >= _loc_12.num;
                            _loc_7.needLevel = _loc_12.num;
                        }
                    }
                    _loc_11++;
                }
            }
            _loc_7.value2 = param4;
            _loc_7.value1 = param1;
            _loc_7.data = param2;
            return _loc_7;
        }// end function

        public static function outPool() : GLinkTextData
        {
            if (_pool.length == 0)
            {
                return new GLinkTextData();
            }
            return _pool.shift();
        }// end function

        public static function inPool(param1:GLinkTextData) : void
        {
            param1.htmlText = "";
            param1.mapId = 0;
            param1.x = 0;
            param1.y = 0;
            param1.type = "";
            param1.value1 = 0;
            param1.value2 = 0;
            param1.needBoot = true;
            param1.curNum = 0;
            param1.totalNum = 0;
            param1.data = null;
            param1.isLevelEnouth = false;
            param1.endSecond = GLinkTextData.NoTimer;
            param1.subType = null;
            _pool.push(param1);
            return;
        }// end function

    }
}
